package org.finesys.common.hazelcast.core.mq;

import cn.hutool.core.util.TypeUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;

@Getter
@Setter
public abstract class AbstractGroupMessageListener<T extends AbstractGroupMessage> implements HazelcastMessageListener<T> {


    /**
     * 消息类型
     */
    private final Class<T> messageType;

    /**
     * topic
     */
    private final String group;


    @SneakyThrows
    protected AbstractGroupMessageListener() {
        this.messageType = (Class<T>) TypeUtil.getTypeArgument(getClass(), 0);
        this.group = messageType.newInstance().getGroup();
    }


}
